package com.jin.jpa.wrapper.expression;

import com.jin.jpa.wrapper.LambdaWrapperContext;

import javax.persistence.criteria.Expression;

/**
 * @Author: yuanxiuyao
 * @Date: 2024/1/8 16:31
 * @PackageName: org.example.jpa.wrapper.expression
 * @Version 1.0
 */
public class GroupByExpression implements IExpression<Expression<?>>{

    private String expression;

    private GroupByExpression(String expression){
        this.expression = expression;
    }

    public static GroupByExpression of(String expression){
        return new GroupByExpression(expression);
    }

    @Override
    public Expression<?> toHandle(LambdaWrapperContext<?> context) {
        return context.getRoot().get(expression);
    }
}
